package com.ruoyi.flow.common.tools.mediaconverter.converter.reflections.scanners;

import java.lang.annotation.Inherited;
import java.util.List;

import com.ruoyi.flow.common.tools.mediaconverter.converter.reflections.util.JavaReflectionUtils;

/** scans for class's annotations, where @Retention(RetentionPolicy.RUNTIME) */
@SuppressWarnings({"unchecked"})
public class TypeAnnotationsScanner extends AbstractScanner {
    public void scan(final Class cls) {
		final String className = JavaReflectionUtils.getClassName(cls);

        for (String annotationType : (List<String>) JavaReflectionUtils.getClassAnnotationNames(cls)) {

            if (acceptResult(annotationType) ||
                annotationType.equals(Inherited.class.getName())) { //as an exception, accept Inherited as well
                getStore().put(annotationType, className);
            }
        }
    }

}
